function e() {
    var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, n = e.timer, r = void 0 === n ? null : n, a = e.type, i = void 0 === a ? null : a, u = e.interval, l = void 0 === u ? "/" : u, o = r ? new Date(r) : new Date(), s = o.getFullYear(), c = t(o.getMonth() + 1), g = t(o.getDate()), m = t(o.getHours()), v = t(o.getMinutes()), w = t(o.getSeconds()), d = "";
    switch (i) {
      case 0:
        d = "" + s + l + c + l + g + " 00:00:00";
        break;

      case 1:
        d = "" + s + l + c + l + g + " " + m + ":" + v;
        break;

      case 2:
        d = "" + s + l + c + l + g;
        break;

      case 3:
        d = m + ":" + v + ":" + w;
        break;

      case 4:
        d = m + ":" + v;
        break;

      default:
        d = "" + s + l + c + l + g + " " + m + ":" + v + ":" + w;
    }
    return d;
}

function t(e) {
    return (e += "").length < 2 ? "0" + e : e;
}

function n(t) {
    var n = new Date(e({
        type: 0
    })).getTime(), r = new Date(t).getTime();
    return r > n ? e({
        timer: t,
        type: 4
    }) : n - r < 864e5 ? "昨天 " + e({
        timer: t,
        type: 4
    }) : "" + e({
        timer: t,
        type: 1
    });
}

var r = null;

module.exports = {
    showTimer: function(e) {
        if (r) return Math.abs(new Date(e).getTime() - new Date(r).getTime()) > 12e4 ? (r = e, 
        n(e)) : null;
        return r = e, n(e);
    },
    initStartTime: function() {
        r = null;
    }
};